home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume14 / jove4.9 / part02 < prev    next >
Encoding:
Internet Message Format  |  1988-04-25  |  51.5 KB

  1. Subject:  v14i058:  Jove, an emacs variant, version 4.9, Part02/21
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Jonathan Payne <jpayne@cs.rochester.edu>
  7. Posting-number: Volume 14, Issue 58
  8. Archive-name: jove4.9/part02
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 2 (of 21)."
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. if test -f './doc/jove.qref' -a "${1}" != "-c" ; then 
  19.   echo shar: Will not clobber existing file \"'./doc/jove.qref'\"
  20. else
  21. echo shar: Extracting \"'./doc/jove.qref'\" \(5757 characters\)
  22. sed "s/^X//" >'./doc/jove.qref' <<'END_OF_FILE'
  23. X                    JOVE Command Quick Reference Guide
  24. X
  25. X--- HELP
  26. apropos                    describe-bindings            describe-command    ESC ?
  27. describe-key        C-X ?        describe-variable            execute-named-command    ESC X
  28. X
  29. X
  30. X--- MOVING AROUND
  31. backward-character    C-B        backward-list        ESC C-P        backward-paragraph    ESC [
  32. backward-s-expression    ESC C-B        backward-sentence    ESC A        backward-up-list    ESC C-U
  33. backward-word        ESC B        beginning-of-file    ESC <        beginning-of-line    C-A
  34. beginning-of-window    ESC ,        current-error                down-list        ESC C-D
  35. end-of-file        ESC >        end-of-line        C-E        end-of-window        ESC .
  36. find-tag        C-X T        find-tag-at-point            first-non-blank        ESC M
  37. forward-character    C-F        forward-list        ESC C-N        forward-paragraph    ESC ]
  38. forward-s-expression    ESC C-F        forward-sentence    ESC E        forward-word        ESC F
  39. goto-line        ESC G        next-error        C-X C-N        next-line        C-N
  40. next-page        C-V        previous-error        C-X C-P        previous-line        C-P
  41. previous-page        ESC V        window-find-tag        C-X 4 t        
  42. X
  43. X--- INSERTING AND DELETING
  44. delete-blank-lines    C-X C-O        delete-next-char    C-D        delete-previous-char    C-H (DEL)
  45. delete-white-space    ESC-\        erase-buffer                handle-tab        C-I (TAB)
  46. kill-next-word        ESC D        kill-next-word        ESC d        kill-previous-word    ESC ^?
  47. kill-s-expression    ESC C-K        kill-to-beginning-of-se    C-X ^?        kill-to-end-of-line    C-K
  48. kill-to-end-of-sentence    ESC K        newline            C-M (RETURN)    newline-and-backup    C-O
  49. newline-and-indent    C-J        over-write-mode                quoted-insert        C-^
  50. X
  51. X
  52. X--- SEARCH AND REPLACE
  53. find-tag        C-X T        find-tag-at-point            i-search-forward    
  54. i-search-reverse            query-replace-string    ESC Q        replace-in-region    
  55. replace-string        ESC R        search-forward        C-\        search-reverse        C-R
  56. window-find-tag        C-X 4 t        
  57. X
  58. X--- MARKS AND REGIONS
  59. append-region                append-region                case-region-lower    
  60. case-region-upper            copy-region        ESC W        exchange-point-and-mark    C-X C-X
  61. filter-region                kill-region        C-W        replace-in-region    
  62. set-mark        C-@ (C-SPACE)    write-region                yank            C-Y
  63. yank-pop        ESC Y        
  64. X
  65. X--- TEXT PROCESSING
  66. auto-fill-mode                bind-macro-to-word-abbr            case-character-capitali    
  67. case-region-lower            case-region-upper            case-word-capitalize    ESC C
  68. case-word-lower        ESC L        case-word-upper        ESC U        current-error        
  69. define-global-word-abbr            define-mode-word-abbrev            edit-word-abbrevs    
  70. fill-paragraph        ESC J        fill-region                left-margin-here    
  71. next-error        C-X C-N        over-write-mode                parse-spelling-errors-i    
  72. previous-error        C-X C-P        read-word-abbrev-file            right-margin-here    
  73. spell-buffer                text-mode                transpose-characters    C-T
  74. transpose-lines        C-X C-T        visible-spaces-in-windo            word-abbrev-mode    
  75. write-word-abbrev-file            
  76. X
  77. X--- DISPLAY AND WINDOWS
  78. clear-and-redraw    ESC C-L        delete-current-window    C-X D        delete-current-window    C-X d
  79. delete-other-windows    C-X 1        grow-window        C-X ^        next-window        C-X N
  80. number-lines-in-window            page-next-window    ESC C-V        previous-window        C-X P
  81. redraw-display        C-L        scroll-down        ESC Z        scroll-up        C-Z
  82. shrink-window                split-current-window    C-X 2        window-find-buffer    C-X 4 b
  83. window-find-file    C-X 4 f        window-find-tag        C-X 4 t        
  84. X
  85. X--- FILES AND BUFFERS
  86. append-region                append-region                buffer-position        
  87. delete-buffer        C-X K        delete-buffer        C-X k        erase-buffer        
  88. find-file        C-X C-F        insert-file        C-X C-I        kill-buffer        C-X K
  89. list-buffers        C-X C-B        make-buffer-unmodified    ESC ~        read-macros-from-file    
  90. read-word-abbrev-file            rename-buffer                save-file        C-X C-\
  91. save-file        C-X C-S        select-buffer        C-X B        select-existing-buffer    C-X B
  92. spell-buffer                visit-file        C-X C-V        visit-file        C-X C-R
  93. window-find-buffer    C-X 4 b        window-find-file    C-X 4 f        write-file        C-X C-W
  94. write-macros-to-file            write-modified-files    C-X C-M        write-region        
  95. write-word-abbrev-file            
  96. X
  97. X--- DIRECTORIES
  98. cd                    dirs                    popd            
  99. pushd                    pwd                    
  100. X
  101. X
  102. X--- PROGRAMMERS
  103. auto-indent-mode            backward-s-expression    ESC C-B        c-mode            
  104. compile-it(make)    C-X C-E        current-error                fill-comment        
  105. forward-s-expression    ESC C-F        grind-s-expr                kill-s-expression    ESC C-K
  106. lisp-mode                next-error        C-X C-N        number-lines-in-window    
  107. paren-flash        ),],}        parse-errors                parse-special-errors    
  108. previous-error        C-X C-P        show-match-mode                string-length        
  109. visible-spaces-in-windo            
  110. X
  111. X--- REPEAT
  112. digit            ESC -        digit            ESC [0-9]    quadruple-numeric-argum    C-U
  113. X
  114. X
  115. X--- MACROS
  116. delete-macro                execute-keyboard-macro    C-X E        make-macro-interactive    
  117. make-macro-interactive    ESC I        read-macros-from-file            begin-kbd-macro    C-X (
  118. end-kbd-macro        C-X )        write-macros-to-file            
  119. X
  120. X--- SHELL
  121. exit-jove        C-X C-C        i-shell-command                pause-jove        ESC S
  122. pause-jove        ESC s        push-shell                shell            
  123. shell-command        C-X !        shell-command-to-buffer            suspend-jove        
  124. X
  125. X
  126. X--- PROCESSES
  127. eof-process                interrupt-process    C-C        kill-process        
  128. list-processes                process-bind-to-key            process-newline        C-M (RETURN)
  129. process-send-data-no-re            quit-process                stop-process        
  130. X
  131. X
  132. X--- MISCELLANEOUS
  133. auto-execute-command            auto-execute-macro            bind-macro-to-key    
  134. bind-macro-to-word-abbr            bind-to-key                character-to-octal-inse    
  135. date                    execute-extended-comman    ESC X        fundamental-mode    
  136. print                    recursive-edit                ring-the-bell(ABORT)    C-G
  137. set                    source                    unbind-key        
  138. version                    
  139. X
  140. X--- VARIABLES
  141. allow-^S-and-^Q                allow-bad-filenames            auto-case-abbrev    
  142. bad-filename-extensions            c-indentation-increment            case-ignore-search    
  143. comment-format                disable-biff                error-window-size    
  144. file-creation-mode            files-should-end-with-n            internal-tabstop    
  145. left-margin                mailbox                    mail-check-frequency    
  146. make-backup-files            mark-threshold                marks-should-float    
  147. match-regular-expressio            meta-key                mode-line        
  148. mode-line-should-stando            paren-flash-delay            physical-tabstop    
  149. process-prompt                interrupt-character            right-margin        
  150. scroll-step                search-exit-char            send-typeout-to-buffer    
  151. shell                    shell-flags                sync-frequency        
  152. tag-file                tmp-file-pathname            update-time-frequency    
  153. use-i/d-char                visible-bell                wrap-search        
  154. write-files-on-make            
  155. END_OF_FILE
  156. if test 5757 -ne `wc -c <'./doc/jove.qref'`; then
  157.     echo shar: \"'./doc/jove.qref'\" unpacked with wrong size!
  158. fi
  159. # end of './doc/jove.qref'
  160. fi
  161. if test -f './mac.h' -a "${1}" != "-c" ; then 
  162.   echo shar: Will not clobber existing file \"'./mac.h'\"
  163. else
  164. echo shar: Extracting \"'./mac.h'\" \(4616 characters\)
  165. sed "s/^X//" >'./mac.h' <<'END_OF_FILE'
  166. X/***************************************************************************
  167. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  168. X * is provided to you without charge, and with no warranty.  You may give  *
  169. X * away copies of JOVE, including sources, provided that this notice is    *
  170. X * included in all the files.                                              *
  171. X ***************************************************************************/
  172. X
  173. X/* Macintosh related things. K. Mitchum 2/88 */
  174. X
  175. X
  176. X#define NMENUS 6
  177. X#define NMENUITEMS 40    /* This has GOT to be enough! */
  178. X    
  179. typedef data_obj *menumap[NMENUITEMS];
  180. X#ifndef _mac
  181. X    typedef char **MenuHandle;
  182. X#endif
  183. struct menu {
  184. X    char *Name;
  185. X    int menu_id;
  186. X    MenuHandle Mn;
  187. X    menumap m;
  188. X};
  189. X
  190. struct stat {
  191. X    int st_dev;        /* volume number */
  192. X    long st_ino;        /* file number on volume */
  193. X    dev_t st_rdev;
  194. X    off_t st_size;        /* logical end of file */
  195. X    int st_mode;
  196. X    time_t st_mtime;    /* last modified */
  197. X};
  198. X
  199. X#define S_IFDIR 2
  200. X
  201. typedef char *va_list;
  202. X#define va_dcl va_list va_alist;
  203. X#define va_start(l) l = (va_list)&va_alist
  204. X#define va_arg(l,m) ((m*)(l += sizeof(m)))[-1]
  205. X#define va_end(l) l = NULL
  206. X
  207. X#ifdef _mac
  208. extern struct menu Menus[NMENUS];
  209. X
  210. static    EventRecord the_Event;
  211. X
  212. X/* keycodes (from Inside MacIntosh I-251). because of changes with
  213. the MacPlus, there are some duplicate codes between cursor keys and
  214. keypad keys. these can be deciphered by the corresponding character
  215. codes, which are different. this table simply translates a keycode
  216. into a character code that is appropriate. */
  217. X
  218. X#define NOKEY -1
  219. X#define RET 0x0D    
  220. X#define TAB 0x09    
  221. X#define BACKSP 0x08
  222. X#define ENTERL NOKEY    /* left enter key absent on MacPlus */
  223. X#define COMMAND NOKEY    /* will be no translation anyway for these */
  224. X#define SHIFT NOKEY
  225. X#define CAPSLOCK NOKEY
  226. X#define OPTION NOKEY
  227. X#define PADDOT '.'        /* PAD period */
  228. X#define PAD0 '0'
  229. X#define PAD1 '1'
  230. X#define PAD2 '2'
  231. X#define PAD3 '3'
  232. X#define PAD4 '4'
  233. X#define PAD5 '5'
  234. X#define PAD6 '6'
  235. X#define PAD7 '7'
  236. X#define PAD8 '8'
  237. X#define PAD9 '9'
  238. X#define LEFTCURS 'B'        /* jove only, make like commands */
  239. X#define RIGHTCURS 'F'
  240. X#define UPCURS 'P'
  241. X#define DOWNCURS 'N'
  242. X#define PADENTER RET
  243. X#define PADMINUS '-'
  244. X#define CLEAR 0
  245. X
  246. static char nsh_keycodes[] = {
  247. X    'a','s','d','f','h',                        /* 0 - 4 */
  248. X    'g','z','x','c','v',                        /* 5 - 9 */
  249. X    NOKEY,'b','q','w','e',                    /* 10 - 14 */
  250. X    'r','y','t','1','2',                    /* 15 - 19 */
  251. X    '3','4','6','5','=',                    /* 20 - 24 */
  252. X    '9','7','-','8','0',                    /* 25 - 29 */
  253. X    ']','O','u','[','i',                    /* 30 - 34 */
  254. X    'p',RET,'l','j','\'',                    /* 35 - 39 */
  255. X    'k',';','\\',',','/',                    /* 40 - 44 */
  256. X    'n','m','.',TAB,NOKEY,                    /* 45 - 49 */
  257. X    '`',BACKSP,ENTERL,NOKEY,NOKEY,            /* 50 - 54 */
  258. X    COMMAND,SHIFT,CAPSLOCK,OPTION, NOKEY,    /* 55 - 59 */
  259. X    NOKEY,NOKEY,NOKEY,NOKEY,NOKEY,            /* 60 - 64 */
  260. X    PADDOT,RIGHTCURS,NOKEY,NOKEY,NOKEY,        /* 65 - 69 */
  261. X    LEFTCURS,CLEAR,DOWNCURS,NOKEY,NOKEY,    /* 70 - 74 */
  262. X    NOKEY,PADENTER,UPCURS,PADMINUS,NOKEY,    /* 75 - 79 */
  263. X    NOKEY,NOKEY,PAD0,PAD1,PAD2,                /* 80 - 84 */
  264. X    PAD3,PAD4,PAD5,PAD6,PAD7,                /* 85 - 89 */
  265. X    NOKEY,PAD8,PAD9
  266. X};
  267. X
  268. static char sh_keycodes[] = {
  269. X    'A','S','D','F','H',                        /* 0 - 4 */
  270. X    'G','Z','X','C','V',                        /* 5 - 9 */
  271. X    NOKEY,'B','Q','W','E',                    /* 10 - 14 */
  272. X    'R','Y','T','!','@',                    /* 15 - 19 */
  273. X    '#','$','^','%','+',                    /* 20 - 24 */
  274. X    '(','&','_','*',')',                    /* 25 - 29 */
  275. X    '}','O','U','{','I',                    /* 30 - 34 */
  276. X    'P',RET,'L','J','\'',                    /* 35 - 39 */
  277. X    'K',';','|','<','?',                    /* 40 - 44 */
  278. X    'N','M','>',TAB,NOKEY,                    /* 45 - 49 */
  279. X    '~',BACKSP,ENTERL,NOKEY,NOKEY,            /* 50 - 54 */
  280. X    COMMAND,SHIFT,CAPSLOCK,OPTION, NOKEY,    /* 55 - 59 */
  281. X    NOKEY,NOKEY,NOKEY,NOKEY,NOKEY,            /* 60 - 64 */
  282. X    PADDOT,RIGHTCURS,NOKEY,NOKEY,NOKEY,        /* 65 - 69 */
  283. X    LEFTCURS,CLEAR,DOWNCURS,NOKEY,NOKEY,    /* 70 - 74 */
  284. X    NOKEY,PADENTER,UPCURS,PADMINUS,NOKEY,    /* 75 - 79 */
  285. X    NOKEY,NOKEY,PAD0,PAD1,PAD2,                /* 80 - 84 */
  286. X    PAD3,PAD4,PAD5,PAD6,PAD7,                /* 85 - 89 */
  287. X    NOKEY,PAD8,PAD9
  288. X};
  289. X
  290. X
  291. X
  292. X/* tn.h Modified for variable screen size 11/21/87. K. Mitchum */
  293. X
  294. static int tn_rows, tn_cols, tn_top, tn_left, tn_bottom, tn_right;
  295. int MAXROW, MAXCOL;
  296. X
  297. X#define SCREENSIZE (tn_rows * ROWSIZE)
  298. X#define FONT monaco
  299. X#define TEXTSIZE 9
  300. X
  301. X#define HEIGHT 11
  302. X#define WIDTH 6
  303. X#define DESCENT 2
  304. X#define TWIDTH tn_cols * WIDTH
  305. X#define THEIGHT tn_rows * HEIGHT
  306. X
  307. X/* window specs */
  308. X
  309. X#define SCROLLWIDTH 16 /* width of scroll bar control in pixels */
  310. X#define WINDWIDTH tn_right - tn_left - SCROLLWIDTH - 1/* local coordinates */
  311. X#define WINDHEIGHT tn_bottom - tn_top    /* local coordinates */
  312. X
  313. X/* for keyboard routines */
  314. X#define MCHARS 32    /* must be power of two */
  315. X#define NMASK MCHARS -1    /* circular buffer */
  316. X
  317. X#endif /* _mac */
  318. X
  319. X
  320. END_OF_FILE
  321. if test 4616 -ne `wc -c <'./mac.h'`; then
  322.     echo shar: \"'./mac.h'\" unpacked with wrong size!
  323. fi
  324. # end of './mac.h'
  325. fi
  326. if test -f './malloc.c' -a "${1}" != "-c" ; then 
  327.   echo shar: Will not clobber existing file \"'./malloc.c'\"
  328. else
  329. echo shar: Extracting \"'./malloc.c'\" \(4027 characters\)
  330. sed "s/^X//" >'./malloc.c' <<'END_OF_FILE'
  331. X/***************************************************************************
  332. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  333. X * is provided to you without charge, and with no warranty.  You may give  *
  334. X * away copies of JOVE, including sources, provided that this notice is    *
  335. X * included in all the files.                                              *
  336. X ***************************************************************************/
  337. X
  338. X#include "tune.h"
  339. X
  340. X#ifdef MY_MALLOC
  341. X
  342. X/*    avoid break bug */
  343. X#ifdef pdp11
  344. X#    define GRANULE 64
  345. X#else
  346. X#    define GRANULE 0
  347. X#endif
  348. X
  349. X/*    C storage allocator
  350. X *    circular first-fit strategy
  351. X *    works with noncontiguous, but monotonically linked, arena
  352. X *    each block is preceded by a ptr to the (pointer of) 
  353. X *    the next following block
  354. X *    blocks are exact number of words long 
  355. X *    aligned to the data type requirements of ALIGN
  356. X *    pointers to blocks must have BUSY bit 0
  357. X *    bit in ptr is 1 for busy, 0 for idle
  358. X *    gaps in arena are merely noted as busy blocks
  359. X *    last block of arena (pointed to by alloct) is empty and
  360. X *    has a pointer to first
  361. X *    idle blocks are coalesced during space search
  362. X *
  363. X *    a different implementation may need to redefine
  364. X *    ALIGN, NALIGN, BLOCK, BUSY, INT
  365. X *    where INT is integer type to which a pointer can be cast
  366. X */
  367. X
  368. X#define INT        int
  369. X#define ALIGN        int
  370. X#define NALIGN        1
  371. X#define WORD        sizeof(union store)
  372. X#define BLOCK        1024    /* a multiple of WORD*/
  373. X#define BUSY        1
  374. X#define NULL        0
  375. X#define testbusy(p)    ((INT)(p)&BUSY)
  376. X#define setbusy(p)    (union store *) ((INT) (p) | BUSY)
  377. X#define clearbusy(p)    (union store *) ((INT) (p) &~ BUSY)
  378. X
  379. union store {
  380. X    union store    *ptr;
  381. X    ALIGN    dummy[NALIGN];
  382. X    int    calloc;        /*calloc clears an array of integers*/
  383. X};
  384. X
  385. static union store    allocs[2],    /*initial arena*/
  386. X            *allocp,    /*search ptr*/
  387. X            *alloct,    /*arena top*/
  388. X            *allocx;    /*for benefit of realloc*/
  389. X
  390. char    *sbrk();
  391. X
  392. char *
  393. malloc(nbytes)
  394. unsigned int    nbytes;
  395. X{
  396. X    register union store    *p,
  397. X                *q;
  398. X    register int    nw;
  399. X    static int    temp;    /* coroutines assume no auto */
  400. X
  401. X    if (allocs[0].ptr == 0) {    /* first time */
  402. X        allocs[0].ptr = setbusy(&allocs[1]);
  403. X        allocs[1].ptr = setbusy(&allocs[0]);
  404. X        alloct = &allocs[1];
  405. X        allocp = &allocs[0];
  406. X    }
  407. X    nw = (nbytes + WORD + WORD - 1) / WORD;
  408. X    for (p = allocp; ; ) {
  409. X        for (temp = 0; ; ) {
  410. X            if (!testbusy(p->ptr)) {
  411. X                while (!testbusy((q = p->ptr)->ptr))
  412. X                    p->ptr = q->ptr;
  413. X                if(q >= p + nw && p + nw >= p)
  414. X                    goto found;
  415. X            }
  416. X            q = p;
  417. X            p = clearbusy(p->ptr);
  418. X            if (p > q)
  419. X                ;
  420. X            else if (q != alloct || p != allocs)
  421. X                return NULL;
  422. X            else if (++temp > 1)
  423. X                break;
  424. X        }
  425. X        temp = ((nw + BLOCK/WORD) / (BLOCK/WORD)) * (BLOCK/WORD);
  426. X        q = (union store *) sbrk(0);
  427. X        if (q + temp + GRANULE < q)
  428. X            return NULL;
  429. X        q = (union store *) sbrk(temp * WORD);
  430. X        if ((INT) q == -1)
  431. X            return NULL;
  432. X        alloct->ptr = q;
  433. X        if (q != alloct+1)
  434. X            alloct->ptr = setbusy(alloct->ptr);
  435. X        alloct = q->ptr = q + temp - 1;
  436. X        alloct->ptr = setbusy(allocs);
  437. X    }
  438. found:
  439. X    allocp = p + nw;
  440. X    if (q > allocp) {
  441. X        allocx = allocp->ptr;
  442. X        allocp->ptr = p->ptr;
  443. X    }
  444. X    p->ptr = setbusy(allocp);
  445. X    return (char *) (p + 1);
  446. X}
  447. X
  448. X/* freeing strategy tuned for LIFO allocation */
  449. X
  450. free(ap)
  451. register char    *ap;
  452. X{
  453. X    register union store    *p = (union store *) ap;
  454. X
  455. X    allocp = --p;
  456. X    p->ptr = clearbusy(p->ptr);
  457. X}
  458. X
  459. X/*    realloc(p, nbytes) reallocates a block obtained from malloc()
  460. X *    and freed since last call of malloc()
  461. X *    to have new size nbytes, and old content
  462. X *    returns new location, or 0 on failure
  463. X*/
  464. X
  465. char *
  466. realloc(obj, nbytes)
  467. char    *obj;
  468. unsigned int    nbytes;
  469. X{
  470. X    register union store    *q,
  471. X                *p = (union store *) obj;
  472. X    union store    *s,
  473. X            *t;
  474. X    register unsigned int    nw;
  475. X    unsigned int    onw;
  476. X
  477. X    if (testbusy(p[-1].ptr))
  478. X        free((char *) p);
  479. X    onw = p[-1].ptr - p;
  480. X    q = (union store *) malloc(nbytes);
  481. X    if(q == NULL || q == p)
  482. X        return((char *) q);
  483. X    s = p;
  484. X    t = q;
  485. X    nw = (nbytes + WORD - 1)/WORD;
  486. X    if (nw < onw)
  487. X        onw = nw;
  488. X    while (onw-- != 0)
  489. X        *t++ = *s++;
  490. X    if(q < p && q + nw >= p)
  491. X        (q + (q+nw-p))->ptr = allocx;
  492. X    return (char *) q;
  493. X}
  494. X
  495. X#endif /* MY_MALLOC */
  496. END_OF_FILE
  497. if test 4027 -ne `wc -c <'./malloc.c'`; then
  498.     echo shar: \"'./malloc.c'\" unpacked with wrong size!
  499. fi
  500. # end of './malloc.c'
  501. fi
  502. if test -f './marks.c' -a "${1}" != "-c" ; then 
  503.   echo shar: Will not clobber existing file \"'./marks.c'\"
  504. else
  505. echo shar: Extracting \"'./marks.c'\" \(4499 characters\)
  506. sed "s/^X//" >'./marks.c' <<'END_OF_FILE'
  507. X/***************************************************************************
  508. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  509. X * is provided to you without charge, and with no warranty.  You may give  *
  510. X * away copies of JOVE, including sources, provided that this notice is    *
  511. X * included in all the files.                                              *
  512. X ***************************************************************************/
  513. X
  514. int    MarksShouldFloat = 1;
  515. X
  516. X#include "jove.h"
  517. X
  518. Mark *
  519. MakeMark(line, column, type)
  520. register Line    *line;
  521. X{
  522. X    register Mark    *newmark = (Mark *) emalloc(sizeof *newmark);
  523. X
  524. X    MarkSet(newmark, line, column);
  525. X    newmark->m_next = curbuf->b_marks;
  526. X    newmark->m_flags = type;
  527. X    curbuf->b_marks = newmark;
  528. X    return newmark;
  529. X}
  530. X
  531. void
  532. flush_marks(b)
  533. Buffer    *b;
  534. X{
  535. X    register Mark    *m,
  536. X            *next;
  537. X
  538. X    m = b->b_marks;
  539. X    while (m != 0) {
  540. X        next = m->m_next;
  541. X        free((char *) m);
  542. X        m = next;
  543. X    }
  544. X}
  545. X
  546. void
  547. DelMark(m)
  548. register Mark    *m;
  549. X{
  550. X    register Mark    *mp = curbuf->b_marks;
  551. X
  552. X    if (m == mp)
  553. X        curbuf->b_marks = m->m_next;
  554. X    else {
  555. X        while (mp != 0 && mp->m_next != m)
  556. X            mp = mp->m_next;
  557. X        if (mp == 0)
  558. X            complain("Unknown mark!");
  559. X        mp->m_next = m->m_next;
  560. X    }
  561. X    free((char *) m);
  562. X}
  563. X
  564. void
  565. AllMarkSet(b, line, col)
  566. Buffer    *b;
  567. register Line    *line;
  568. X{
  569. X    register Mark    *mp;
  570. X
  571. X    for (mp = b->b_marks; mp != 0; mp = mp->m_next)
  572. X        MarkSet(mp, line, col);
  573. X}
  574. X
  575. void
  576. MarkSet(m, line, column)
  577. Mark    *m;
  578. Line    *line;
  579. X{
  580. X    m->m_line = line;
  581. X    m->m_char = column;
  582. X}
  583. X
  584. void
  585. PopMark()
  586. X{
  587. X    int    pmark;
  588. X
  589. X    if (curmark == 0)
  590. X        return;
  591. X    if (curbuf->b_markring[(curbuf->b_themark + 1) % NMARKS] == 0) {
  592. X        pmark = curbuf->b_themark;
  593. X        do {
  594. X            if (--pmark < 0)
  595. X                pmark = NMARKS - 1;
  596. X        } while (curbuf->b_markring[pmark] != 0);
  597. X
  598. X        curbuf->b_markring[pmark] = MakeMark(curline, curchar, MarksShouldFloat ? M_FLOATER : M_FIXED);
  599. X        ToMark(curmark);
  600. X        DelMark(curmark);
  601. X        curmark = 0;
  602. X    } else
  603. X        PtToMark();
  604. X
  605. X    pmark = curbuf->b_themark - 1;
  606. X    if (pmark < 0)
  607. X        pmark = NMARKS - 1;
  608. X    curbuf->b_themark = pmark;
  609. X}
  610. X
  611. void
  612. SetMark()
  613. X{
  614. X    if (is_an_arg())
  615. X        PopMark();
  616. X    else
  617. X        set_mark();
  618. X}
  619. X
  620. void
  621. set_mark()
  622. X{
  623. X    do_set_mark(curline, curchar);
  624. X}
  625. X
  626. void
  627. do_set_mark(l, c)
  628. Line    *l;
  629. X{
  630. X    curbuf->b_themark = (curbuf->b_themark + 1) % NMARKS;
  631. X    if (curmark == 0)
  632. X        curmark = MakeMark(l, c, MarksShouldFloat ? M_FLOATER : M_FIXED);
  633. X    else
  634. X        MarkSet(curmark, l, c);
  635. X    s_mess("[Point pushed]");
  636. X}
  637. X
  638. X/* Move point to Mark */
  639. X
  640. void
  641. ToMark(m)
  642. Mark    *m;
  643. X{
  644. X    int    len;
  645. X
  646. X    if (m == 0)
  647. X        return;
  648. X    DotTo(m->m_line, m->m_char);
  649. X    if (curchar > (len = length(curline)))
  650. X        curchar = len;
  651. X}
  652. X
  653. Mark *
  654. CurMark()
  655. X{
  656. X    if (curmark == 0)
  657. X        complain("No mark.");
  658. X    return curmark;
  659. X}
  660. X
  661. void
  662. PtToMark()
  663. X{
  664. X    Line    *mline;
  665. X    int    mchar;
  666. X    Mark    *m = CurMark();
  667. X
  668. X    mline = curline;
  669. X    mchar = curchar;
  670. X
  671. X    ToMark(m);
  672. X    MarkSet(m, mline, mchar);
  673. X}
  674. X
  675. X/* Fix marks for after a deletion.  For now, even marks that don't
  676. X   float will actually float, because we can't allow marks to point
  677. X   to non-existant lines. */
  678. X
  679. void
  680. DFixMarks(line1, char1, line2, char2)
  681. register Line    *line1,
  682. X        *line2;
  683. X{
  684. X    register Mark    *m;
  685. X    Line    *lp = line1;
  686. X
  687. X    if (curbuf->b_marks == 0)
  688. X        return;
  689. X    while (lp != line2->l_next) {
  690. X        for (m = curbuf->b_marks; m != 0; m = m->m_next)
  691. X            if (m->m_line == lp)
  692. X                m->m_char |= (1 << 15);
  693. X        lp = lp->l_next;
  694. X    }
  695. X    for (m = curbuf->b_marks; m; m = m->m_next) {
  696. X        if ((m->m_char & (1 << 15)) == 0)
  697. X            continue;    /* Not effected */
  698. X        m->m_char &= ~(1 << 15);
  699. X        if (m->m_line == line1 && m->m_char < char1)
  700. X            continue;    /* This mark is not affected */
  701. X        if (line1 == line2) {
  702. X            if (m->m_char >= char1 && m->m_char <= char2)
  703. X                m->m_char = char1;
  704. X            else if (m->m_char > char2)
  705. X                m->m_char -= (char2 - char1);
  706. X            /* Same line move the mark backward */
  707. X        } else if (m->m_line == line2) {
  708. X            if (m->m_char > char2)
  709. X                m->m_char = char1 + (m->m_char - char2);
  710. X            else
  711. X                m->m_char = char1;
  712. X            m->m_flags |= M_BIG_DELETE;
  713. X            m->m_line = line1;
  714. X        } else {
  715. X            m->m_char = char1;
  716. X            m->m_line = line1;
  717. X            m->m_flags |= M_BIG_DELETE;
  718. X        }
  719. X    }
  720. X}
  721. X
  722. X/* Fix marks after an insertion.  Marks that don't float are ignored
  723. X   on insertion, which means PtToMark has to be careful ... */
  724. X
  725. void
  726. IFixMarks(line1, char1, line2, char2)
  727. register Line    *line1,
  728. X        *line2;
  729. X{
  730. X    register Mark    *m;
  731. X
  732. X    for (m = curbuf->b_marks; m != 0; m = m->m_next) {
  733. X        if ((m->m_flags & M_FLOATER) == 0)
  734. X            continue;
  735. X        if (m->m_line == line1) {
  736. X            if (m->m_char > char1) {
  737. X                m->m_line = line2;
  738. X                if (line1 == line2)
  739. X                    m->m_char += (char2 - char1);
  740. X                else
  741. X                    m->m_char = char2 + (m->m_char - char1);
  742. X            }
  743. X        } 
  744. X    }
  745. X}
  746. END_OF_FILE
  747. if test 4499 -ne `wc -c <'./marks.c'`; then
  748.     echo shar: \"'./marks.c'\" unpacked with wrong size!
  749. fi
  750. # end of './marks.c'
  751. fi
  752. if test -f './move.c' -a "${1}" != "-c" ; then 
  753.   echo shar: Will not clobber existing file \"'./move.c'\"
  754. else
  755. echo shar: Extracting \"'./move.c'\" \(4844 characters\)
  756. sed "s/^X//" >'./move.c' <<'END_OF_FILE'
  757. X/***************************************************************************
  758. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  759. X * is provided to you without charge, and with no warranty.  You may give  *
  760. X * away copies of JOVE, including sources, provided that this notice is    *
  761. X * included in all the files.                                              *
  762. X ***************************************************************************/
  763. X
  764. X#include "jove.h"
  765. X#include "ctype.h"
  766. X
  767. X#ifdef MAC
  768. X#    undef private
  769. X#    define private
  770. X#endif
  771. X
  772. X#ifdef    LINT_ARGS
  773. private void to_sent(int);
  774. X#else
  775. private void to_sent();
  776. X#endif
  777. X
  778. X#ifdef MAC
  779. X#    undef private
  780. X#    define private static
  781. X#endif
  782. X
  783. static int    line_pos;
  784. X
  785. void
  786. f_char(n)
  787. register int    n;
  788. X{
  789. X    if (n < 0) {
  790. X        b_char(-n);
  791. X        return;
  792. X    }
  793. X    while (--n >= 0) {
  794. X        if (eolp()) {            /* Go to the next Line */
  795. X            if (curline->l_next == 0)
  796. X                break;
  797. X            SetLine(curline->l_next);
  798. X        } else
  799. X            curchar += 1;
  800. X    }
  801. X}
  802. X
  803. void
  804. b_char(n)
  805. register int    n;
  806. X{
  807. X    if (n < 0) {
  808. X        f_char(-n);
  809. X        return;
  810. X    }
  811. X    while (--n >= 0) {
  812. X        if (bolp()) {
  813. X            if (curline->l_prev == 0)
  814. X                break;
  815. X            SetLine(curline->l_prev);
  816. X            Eol();
  817. X        } else
  818. X            curchar -= 1;
  819. X    }
  820. X}
  821. X
  822. void
  823. ForChar()
  824. X{
  825. X    f_char(arg_value());
  826. X}
  827. X
  828. void
  829. BackChar()
  830. X{
  831. X    b_char(arg_value());
  832. X}
  833. X
  834. void
  835. NextLine()
  836. X{
  837. X    if ((curline == curbuf->b_last) && eolp())
  838. X        complain(NullStr);
  839. X    line_move(FORWARD, arg_value(), YES);
  840. X}
  841. X
  842. void
  843. PrevLine()
  844. X{
  845. X    if ((curline == curbuf->b_first) && bolp())
  846. X        complain(NullStr);
  847. X    line_move(BACKWARD, arg_value(), YES);
  848. X}
  849. X
  850. X/* moves to a different line in DIR; LINE_CMD says whether this is
  851. X   being called from NextLine() or PrevLine(), in which case it tries
  852. X   to line up the column with the column of the current line */
  853. X
  854. void
  855. line_move(dir, n, line_cmd)
  856. X{
  857. X    Line    *(*proc)() = (dir == FORWARD) ? next_line : prev_line;
  858. X    Line    *line;
  859. X
  860. X    line = (*proc)(curline, n);
  861. X    if (line == curline) {
  862. X        if (dir == FORWARD) Eol();
  863. X            else Bol();
  864. X        return;
  865. X    }
  866. X
  867. X    if (line_cmd) {
  868. X        this_cmd = LINECMD;
  869. X        if (last_cmd != LINECMD)
  870. X            line_pos = calc_pos(linebuf, curchar);
  871. X    }
  872. X    SetLine(line);        /* curline is in linebuf now */
  873. X    if (line_cmd)
  874. X        curchar = how_far(curline, line_pos);
  875. X}
  876. X
  877. X/* returns what cur_char should be for that position col */
  878. X
  879. int
  880. how_far(line, col)
  881. Line    *line;
  882. X{
  883. X    register char    *lp;
  884. X    register int    pos,
  885. X            c;
  886. X    char    *base;
  887. X
  888. X    base = lp = lcontents(line);
  889. X    pos = 0;
  890. X
  891. X    while (pos < col && (c = (*lp & CHARMASK))) {
  892. X        if (c == '\t')
  893. X            pos += (tabstop - (pos % tabstop));
  894. X        else if (isctrl(c))
  895. X            pos += 2;
  896. X        else
  897. X            pos += 1;
  898. X        lp += 1;
  899. X    }
  900. X
  901. X    return lp - base;
  902. X}
  903. X
  904. void
  905. Bol()
  906. X{
  907. X    curchar = 0;
  908. X}
  909. X
  910. void
  911. Eol()
  912. X{
  913. X    curchar = strlen(linebuf);
  914. X}
  915. X
  916. void
  917. Eof()
  918. X{
  919. X    PushPntp(curbuf->b_last);
  920. X    ToLast();
  921. X}
  922. X
  923. void
  924. Bof()
  925. X{
  926. X    PushPntp(curbuf->b_first);
  927. X    ToFirst();
  928. X}
  929. X
  930. X/* Move forward (if dir > 0) or backward (if dir < 0) a sentence.  Deals
  931. X   with all the kludgery involved with paragraphs, and moving backwards
  932. X   is particularly yucky. */
  933. X
  934. private void
  935. to_sent(dir)
  936. X{
  937. X    Bufpos    *new,
  938. X        old;
  939. X    extern char    *ParaStr;
  940. X
  941. X    DOTsave(&old);
  942. X
  943. X    new = dosearch("^[ \t]*$\\|[?.!]", dir, 1);
  944. X    if (new == 0) {
  945. X        if (dir == BACKWARD) ToFirst();
  946. X            else ToLast();
  947. X        return;
  948. X    }
  949. X    SetDot(new);
  950. X    if (dir < 0) {
  951. X        to_word(1);
  952. X        if ((old.p_line == curline && old.p_char <= curchar) ||
  953. X            (inorder(new->p_line, new->p_char, old.p_line, old.p_char) &&
  954. X             inorder(old.p_line, old.p_char, curline, curchar))) {
  955. X                 SetDot(new);
  956. X                 to_sent(dir);
  957. X        }
  958. X        return;        /* We're there? */
  959. X    }
  960. X    if (blnkp(linebuf)) {
  961. X        Bol();
  962. X        b_char(1);
  963. X        if (old.p_line == curline && old.p_char >= curchar) {
  964. X            to_word(1);    /* Oh brother this is painful */
  965. X            to_sent(1);
  966. X        }
  967. X    } else {
  968. X        extern int    REbom;
  969. X
  970. X        curchar = REbom + 1;    /* Just after the [?.!] */
  971. X        if (LookingAt("[\")]  *\\|[\")]$", linebuf, curchar))
  972. X            curchar += 1;
  973. X        else if (!eolp() && !LookingAt("  *", linebuf, curchar))
  974. X            to_sent(dir);
  975. X    }
  976. X}
  977. X
  978. void
  979. Bos()
  980. X{
  981. X    register int    num = arg_value();
  982. X
  983. X    if (num < 0) {
  984. X        negate_arg_value();
  985. X        Eos();
  986. X        return;
  987. X    }
  988. X
  989. X    while (--num >= 0) {
  990. X        to_sent(-1);
  991. X        if (bobp())
  992. X            break;
  993. X    }
  994. X}
  995. X
  996. void
  997. Eos()
  998. X{
  999. X    register int    num = arg_value();
  1000. X
  1001. X    if (num < 0) {
  1002. X        negate_arg_value();
  1003. X        Bos();
  1004. X        return;
  1005. X    }
  1006. X
  1007. X    while (--num >= 0) {
  1008. X        to_sent(1);
  1009. X        if (eobp())
  1010. X            break;
  1011. X    }
  1012. X}
  1013. X
  1014. void
  1015. f_word(num)
  1016. register int    num;
  1017. X{
  1018. X    register char    c;
  1019. X    if (num < 0) {
  1020. X        b_word(-num);
  1021. X        return;
  1022. X    }
  1023. X    while (--num >= 0) {
  1024. X        to_word(FORWARD);
  1025. X        while ((c = linebuf[curchar]) != 0 && isword(c))
  1026. X            curchar += 1;
  1027. X        if (eobp())
  1028. X            break;
  1029. X    }
  1030. X    this_cmd = 0;    /* Semi kludge to stop some unfavorable behavior */
  1031. X}
  1032. X
  1033. void
  1034. b_word(num)
  1035. register int    num;
  1036. X{
  1037. X    register char    c;
  1038. X
  1039. X    if (num < 0) {
  1040. X        f_word(-num);
  1041. X        return;
  1042. X    }
  1043. X    while (--num >= 0) {
  1044. X        to_word(BACKWARD);
  1045. X        while (!bolp() && (c = linebuf[curchar - 1], isword(c)))
  1046. X            curchar -= 1;
  1047. X        if (bobp())
  1048. X            break;
  1049. X    }
  1050. X    this_cmd = 0;
  1051. X}
  1052. X
  1053. void
  1054. ForWord()
  1055. X{
  1056. X    f_word(arg_value());
  1057. X}
  1058. X
  1059. void
  1060. BackWord()
  1061. X{
  1062. X    b_word(arg_value());
  1063. X}
  1064. END_OF_FILE
  1065. if test 4844 -ne `wc -c <'./move.c'`; then
  1066.     echo shar: \"'./move.c'\" unpacked with wrong size!
  1067. fi
  1068. # end of './move.c'
  1069. fi
  1070. if test -f './scandir.c' -a "${1}" != "-c" ; then 
  1071.   echo shar: Will not clobber existing file \"'./scandir.c'\"
  1072. else
  1073. echo shar: Extracting \"'./scandir.c'\" \(4890 characters\)
  1074. sed "s/^X//" >'./scandir.c' <<'END_OF_FILE'
  1075. X/***************************************************************************
  1076. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  1077. X * is provided to you without charge, and with no warranty.  You may give  *
  1078. X * away copies of JOVE, including sources, provided that this notice is    *
  1079. X * included in all the files.                                              *
  1080. X ***************************************************************************/
  1081. X
  1082. X#include "jove.h"
  1083. X
  1084. X#ifdef MSDOS
  1085. X#include <dos.h>
  1086. X#include <search.h>
  1087. X#endif
  1088. X
  1089. X#ifdef UNIX
  1090. X#include <sys/stat.h>
  1091. X#ifdef M_XENIX
  1092. X#include <sys/ndir.h>
  1093. X#else
  1094. X#include <sys/dir.h>
  1095. X#endif /* M_XENIX */
  1096. X#endif
  1097. X
  1098. X#ifdef F_COMPLETION
  1099. X
  1100. X#ifdef UNIX
  1101. X
  1102. X#if defined(BSD4_2) || defined(M_XENIX)
  1103. X
  1104. X#define DIRSIZE(entry)    DIRSIZ(entry)
  1105. X
  1106. X#else
  1107. X
  1108. X#define DIRSIZE(entry)    (entry->d_name[DIRSIZ-1]=='\0' ? strlen(entry->d_name) : DIRSIZ)
  1109. X
  1110. typedef struct {
  1111. X    int    d_fd;        /* File descriptor for this directory */
  1112. X} DIR;
  1113. X
  1114. DIR *
  1115. opendir(dir)
  1116. char    *dir;
  1117. X{
  1118. X    DIR    *dp = (DIR *) malloc(sizeof *dp);
  1119. X    struct stat    stbuf;
  1120. X
  1121. X    if ((dp->d_fd = open(dir, 0)) == -1)
  1122. X        return 0;
  1123. X    if ((fstat(dp->d_fd, &stbuf) == -1) || !(stbuf.st_mode & S_IFDIR)) {
  1124. X        closedir(dp);
  1125. X        return 0;    /* this isn't a directory! */
  1126. X    }
  1127. X    return dp;
  1128. X}
  1129. X
  1130. closedir(dp)
  1131. DIR    *dp;
  1132. X{
  1133. X    (void) close(dp->d_fd);
  1134. X    free((char *) dp);
  1135. X}
  1136. X
  1137. struct direct *
  1138. readdir(dp)
  1139. DIR    *dp;
  1140. X{
  1141. X    static struct direct    dir;
  1142. X
  1143. X    do
  1144. X        if (read(dp->d_fd, &dir, sizeof dir) != sizeof dir)
  1145. X            return 0;
  1146. X#if defined(elxsi) && defined(SYSV)
  1147. X    /*
  1148. X     * Elxsi has a BSD4.2 implementation which may or may not use
  1149. X     * `twisted inodes' ...  Anyone able to check?
  1150. X     */
  1151. X    while (*(unsigned short *)&dir.d_ino == 0);
  1152. X#else
  1153. X    while (dir.d_ino == 0);
  1154. X#endif
  1155. X
  1156. X    return &dir;
  1157. X}
  1158. X
  1159. X#endif /* BSD4_2 */
  1160. X
  1161. X/* Scandir returns the number of entries or -1 if the directory cannoot
  1162. X   be opened or malloc fails. */
  1163. X
  1164. int
  1165. scandir(dir, nmptr, qualify, sorter)
  1166. char    *dir;
  1167. char    ***nmptr;
  1168. int    (*qualify)();
  1169. int    (*sorter)();
  1170. X{
  1171. X    DIR    *dirp;
  1172. X    struct direct    *entry;
  1173. X    char    **ourarray;
  1174. X    unsigned int    nalloc = 10,
  1175. X            nentries = 0;
  1176. X
  1177. X    if ((dirp = opendir(dir)) == 0)
  1178. X        return -1;
  1179. X    if ((ourarray = (char **) malloc(nalloc * sizeof (char *))) == 0)
  1180. memfail:    complain("[Malloc failed: cannot scandir]");
  1181. X    while ((entry = readdir(dirp)) != 0) {
  1182. X        if (qualify != 0 && (*qualify)(entry->d_name) == 0)
  1183. X            continue;
  1184. X        if (nentries == nalloc) {
  1185. X            ourarray = (char **) realloc((char *) ourarray, (nalloc += 10) * sizeof (char *));
  1186. X            if (ourarray == 0)
  1187. X                goto memfail;
  1188. X        }
  1189. X        ourarray[nentries] = (char *) malloc(DIRSIZE(entry) + 1);
  1190. X        null_ncpy(ourarray[nentries], entry->d_name, (int) DIRSIZE(entry));
  1191. X        nentries += 1;
  1192. X    }
  1193. X    closedir(dirp);
  1194. X    if ((nentries + 1) != nalloc)
  1195. X        ourarray = (char **) realloc((char *) ourarray,
  1196. X                    ((nentries + 1) * sizeof (char *)));
  1197. X    if (sorter != 0)
  1198. X        qsort((char *) ourarray, nentries, sizeof (char **), sorter);
  1199. X    *nmptr = ourarray;
  1200. X    ourarray[nentries] = 0;        /* guaranteed 0 pointer */
  1201. X
  1202. X    return nentries;
  1203. X}
  1204. X
  1205. X#endif /* UNIX */
  1206. X
  1207. X#ifdef MSDOS
  1208. X#define    DIRSIZ    13
  1209. X#define DIRSIZE(entry)    strlen(entry.name)
  1210. X
  1211. X/* Scandir returns the number of entries or -1 if the directory cannoot
  1212. X   be opened or malloc fails. */
  1213. X
  1214. unsigned int fmask = _A_NORMAL|_A_RDONLY|_A_HIDDEN|_A_SUBDIR;
  1215. X
  1216. int
  1217. scandir(dir, nmptr, qualify, sorter)
  1218. char    *dir;
  1219. char    ***nmptr;
  1220. int    (*qualify)();
  1221. int    (*sorter)();
  1222. X{
  1223. X    char dirname[FILESIZE];
  1224. X    struct find_t entry;
  1225. X    char *ptr;
  1226. X    char    **ourarray;
  1227. X    unsigned int    nalloc = 10,
  1228. X            nentries = 0;
  1229. X
  1230. X    strcpy(dirname, dir);
  1231. X    ptr = &dirname[strlen(dirname)-1];
  1232. X    if ((dirname[1] == ':' && !dirname[2]) || (*ptr == '/') || (*ptr == '\\'))
  1233. X       strcat(dirname, "*.*");
  1234. X    else
  1235. X       strcat(dirname, "/*.*");
  1236. X
  1237. X    if (_dos_findfirst(dirname, fmask, &entry))
  1238. X       return -1;
  1239. X    if ((ourarray = (char **) malloc(nalloc * sizeof (char *))) == 0)
  1240. memfail:    complain("[Malloc failed: cannot scandir]");
  1241. X    do  {
  1242. X        if ((fmask == 0x10) && !(entry.attrib&fmask))
  1243. X            goto skip;
  1244. X        strlwr(entry.name);
  1245. X        if (qualify != (int (*)())0 && (*qualify)(entry.name) == 0)
  1246. X            goto skip;
  1247. X        if (nentries == nalloc) {
  1248. X            ourarray = (char **) realloc((char *) ourarray, (nalloc += 10) * sizeof (char *));
  1249. X            if (ourarray == 0)
  1250. X                goto memfail;
  1251. X        }
  1252. X        ourarray[nentries] = (char *) malloc(DIRSIZE(entry) + 1);
  1253. X        null_ncpy(ourarray[nentries], entry.name, (int) DIRSIZE(entry));
  1254. X        nentries++;
  1255. skip:    ;
  1256. X    }
  1257. X    while (_dos_findnext(&entry) == 0);
  1258. X
  1259. X    if ((nentries + 1) != nalloc)
  1260. X        ourarray = (char **) realloc((char *) ourarray,
  1261. X                    ((nentries + 1) * sizeof (char *)));
  1262. X    if (sorter != (int (*)())0)
  1263. X        qsort((char *) ourarray, nentries, sizeof (char **), sorter);
  1264. X    *nmptr = ourarray;
  1265. X    ourarray[nentries] = 0;        /* guaranteed 0 pointer */
  1266. X
  1267. X    return nentries;
  1268. X}
  1269. X
  1270. X#endif /* MSDOS */
  1271. X
  1272. void
  1273. freedir(nmptr, nentries)
  1274. char    ***nmptr;
  1275. X{
  1276. X    char    **ourarray = *nmptr;
  1277. X
  1278. X    while (--nentries >= 0)
  1279. X        free(*ourarray++);
  1280. X    free((char *) *nmptr);
  1281. X    *nmptr = 0;
  1282. X}
  1283. X
  1284. int
  1285. alphacomp(a, b)
  1286. char    **a,
  1287. X    **b;
  1288. X{
  1289. X    return strcmp(*a, *b);
  1290. X}
  1291. X#endif
  1292. END_OF_FILE
  1293. if test 4890 -ne `wc -c <'./scandir.c'`; then
  1294.     echo shar: \"'./scandir.c'\" unpacked with wrong size!
  1295. fi
  1296. # end of './scandir.c'
  1297. fi
  1298. if test -f './setmaps.c' -a "${1}" != "-c" ; then 
  1299.   echo shar: Will not clobber existing file \"'./setmaps.c'\"
  1300. else
  1301. echo shar: Extracting \"'./setmaps.c'\" \(4068 characters\)
  1302. sed "s/^X//" >'./setmaps.c' <<'END_OF_FILE'
  1303. X/***************************************************************************
  1304. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  1305. X * is provided to you without charge, and with no warranty.  You may give  *
  1306. X * away copies of JOVE, including sources, provided that this notice is    *
  1307. X * included in all the files.                                              *
  1308. X ***************************************************************************/
  1309. X
  1310. X#define TXT_TO_C    1    /* must be a number for MAC compiler */
  1311. X
  1312. X#include "funcdefs.c"
  1313. X
  1314. X#ifdef MAC
  1315. X#include "vars.c"
  1316. X#endif
  1317. X
  1318. X#undef putchar    /* From jove.h via funcdefs.c, conflicts with STDIO */
  1319. X#undef putc
  1320. X#undef getc
  1321. X#undef EOF
  1322. X#undef FILE
  1323. X#undef BUFSIZ
  1324. X#undef NULL
  1325. X#include <stdio.h>
  1326. X
  1327. matchcmd(choices, what)
  1328. register struct cmd    choices[];
  1329. register char    *what;
  1330. X{
  1331. X    register int    len;
  1332. X    int    i,
  1333. X        found = 0,
  1334. X        save,
  1335. X        exactmatch = -1;
  1336. X
  1337. X    len = strlen(what);
  1338. X    for (i = 0; choices[i].Name != 0; i++) {
  1339. X        if (*what != *choices[i].Name)
  1340. X            continue;
  1341. X#ifdef MAC /* see "left-margin" and "left-margin-here" */
  1342. X        if (strcmp(what, choices[i].Name) == 0)
  1343. X#else
  1344. X        if (strncmp(what, choices[i].Name, len) == 0)
  1345. X#endif
  1346. X        return i;
  1347. X    }
  1348. X    return -1;
  1349. X}
  1350. X
  1351. X#ifdef MAC
  1352. matchvar(choices, what)
  1353. register struct variable choices[];
  1354. register char    *what;
  1355. X{
  1356. X    register int    len;
  1357. X    int    i,
  1358. X        found = 0,
  1359. X        save,
  1360. X        exactmatch = -1;
  1361. X
  1362. X    len = strlen(what);
  1363. X    for (i = 0; choices[i].Name != 0; i++) {
  1364. X        if (*what != *choices[i].Name)
  1365. X            continue;
  1366. X        if (strcmp(what, choices[i].Name) == 0)
  1367. X            return i;
  1368. X    }
  1369. X    return -1;
  1370. X}
  1371. X#endif
  1372. X
  1373. char *
  1374. PPchar(c)
  1375. int    c;
  1376. X{
  1377. X    static char    str[16];
  1378. X    char    *cp = str;
  1379. X
  1380. X    if (c & 0200) {
  1381. X        c &= ~0200;
  1382. X        strcpy(cp, "M-");
  1383. X        cp += 2;
  1384. X    }
  1385. X    if (c == '\033')
  1386. X        strcpy(cp, "ESC");
  1387. X#ifdef IBMPC
  1388. X    else if (c == '\377')
  1389. X            strcpy(cp, "M");
  1390. X#endif /* IBMPC */
  1391. X    else if (c < ' ')
  1392. X        (void) sprintf(cp, "C-%c", c + '@');
  1393. X    else if (c == '\177')
  1394. X        strcpy(cp, "^?");
  1395. X    else
  1396. X        (void) sprintf(cp, "%c", c);
  1397. X    return str;
  1398. X}
  1399. X
  1400. void
  1401. extract(into, from)
  1402. char    *into,
  1403. X    *from;
  1404. X{
  1405. X    from += 2;    /* Past tab and first double quote. */
  1406. X    while ((*into = *from++) != '"')
  1407. X        into += 1;
  1408. X    *into = 0;
  1409. X}
  1410. X
  1411. X
  1412. void
  1413. X
  1414. X#ifdef MAC
  1415. X_main()        /* for Mac, so we can use redirection */
  1416. X#else
  1417. main()
  1418. X#endif
  1419. X{
  1420. X    FILE    *ifile,
  1421. X        *of;
  1422. X    char    line[100],
  1423. X#ifdef MAC
  1424. X        *which,
  1425. X#endif
  1426. X        comname[70];
  1427. X    int    comnum,
  1428. X        ch,
  1429. X#ifdef MAC
  1430. X        inmenu = 0,
  1431. X#endif
  1432. X        savech = -1,
  1433. X        errors = 0;
  1434. X
  1435. X    ifile = stdin;
  1436. X    of = stdout;
  1437. X    if (ifile == NULL || of == NULL) {
  1438. X        printf("Cannot read input or write output.\n");
  1439. X        exit(1);
  1440. X    }
  1441. X    while (fgets(line, sizeof line, ifile) != NULL) {
  1442. X        if (strncmp(line, "#if", 3) == 0) {
  1443. X            savech = ch;
  1444. X            fprintf(of, line);
  1445. X            continue;
  1446. X        } else if (strncmp(line, "#else", 5) == 0) {
  1447. X            if (savech == -1)
  1448. X                fprintf(stderr, "WARNING: ifdef/endif mismatch!\n");
  1449. X            else
  1450. X                ch = savech;
  1451. X            fprintf(of, line);
  1452. X            continue;
  1453. X        } else if (strncmp(line, "#endif", 6) == 0) {
  1454. X            savech = -1;
  1455. X            fprintf(of, line);
  1456. X            continue;
  1457. X#ifdef MAC
  1458. X        } else if (strncmp(line, "#MENU", 5) == 0) {
  1459. X            inmenu = 1;
  1460. X            continue;
  1461. X#endif
  1462. X        } else if (strncmp(line, "\t\"", 2) != 0) {
  1463. X            fprintf(of, line);
  1464. X            ch = 0;
  1465. X            continue;
  1466. X        }
  1467. X        extract(comname, line);
  1468. X        if (strcmp(comname, "unbound") == 0)
  1469. X            comnum = 12345;
  1470. X        else {
  1471. X#ifdef MAC
  1472. X            which = "commands";
  1473. X#endif
  1474. X            comnum = matchcmd(commands, comname);
  1475. X#ifdef MAC
  1476. X            if (comnum < 0 && inmenu) {
  1477. X                comnum = matchvar(variables, comname);
  1478. X                which = "variables";
  1479. X            }
  1480. X#endif
  1481. X            if (comnum < 0) {
  1482. X#ifdef MAC
  1483. X                fprintf(stderr, "Warning: cannot find item \"%s\".\n", comname);
  1484. X#else
  1485. X                fprintf(stderr, "Warning: cannot find command \"%s\".\n", comname);
  1486. X#endif
  1487. X                errors += 1;
  1488. X                comnum = 12345;
  1489. X            }
  1490. X        }
  1491. X#ifdef MAC
  1492. X        if(inmenu) {
  1493. X            if (comnum == 12345)
  1494. X                fprintf(of, "    (data_obj *) 0,\n");
  1495. X            else
  1496. X                fprintf(of, "    (data_obj *) &%s[%d],\n",which, comnum);
  1497. X        } 
  1498. X        else {
  1499. X#endif
  1500. X        if (comnum == 12345)
  1501. X            fprintf(of, "    (data_obj *) 0,                 /* %s */\n", PPchar(ch++));
  1502. X        else
  1503. X            fprintf(of, "    (data_obj *) &commands[%d],    /* %s */\n", comnum, PPchar(ch++));
  1504. X    }
  1505. X#ifdef MAC
  1506. X    }
  1507. X#endif
  1508. X    fclose(of);
  1509. X    fclose(ifile);
  1510. X    exit(errors);
  1511. X}
  1512. END_OF_FILE
  1513. if test 4068 -ne `wc -c <'./setmaps.c'`; then
  1514.     echo shar: \"'./setmaps.c'\" unpacked with wrong size!
  1515. fi
  1516. # end of './setmaps.c'
  1517. fi
  1518. if test -f './term.c' -a "${1}" != "-c" ; then 
  1519.   echo shar: Will not clobber existing file \"'./term.c'\"
  1520. else
  1521. echo shar: Extracting \"'./term.c'\" \(4482 characters\)
  1522. sed "s/^X//" >'./term.c' <<'END_OF_FILE'
  1523. X/***************************************************************************
  1524. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  1525. X * is provided to you without charge, and with no warranty.  You may give  *
  1526. X * away copies of JOVE, including sources, provided that this notice is    *
  1527. X * included in all the files.                                              *
  1528. X ***************************************************************************/
  1529. X
  1530. X#include "jove.h"
  1531. X#include <ctype.h>
  1532. X#include <errno.h>
  1533. X
  1534. X#ifndef MAC    /* most of the file... */
  1535. X
  1536. X#ifndef MSDOS
  1537. X#ifdef SYSV
  1538. X#   include <termio.h>
  1539. X#else
  1540. X#   include <sgtty.h>
  1541. X#endif /* SYSV */
  1542. X#endif /* MSDOS */
  1543. X
  1544. X#ifdef IPROCS
  1545. X#   include <signal.h>
  1546. X#endif
  1547. X
  1548. X#define _TERM
  1549. X#include "termcap.h"
  1550. X
  1551. X/* Termcap definitions */
  1552. X
  1553. X#ifndef IBMPC
  1554. char    *CS,
  1555. X    *SO,
  1556. X    *SE,
  1557. X    *CM,
  1558. X    *CL,
  1559. X    *CE,
  1560. X    *HO,
  1561. X    *AL,
  1562. X    *DL,
  1563. X    *VS,
  1564. X    *VE,
  1565. X    *KS,
  1566. X    *KE,
  1567. X    *TI,
  1568. X    *TE,
  1569. X    *IC,
  1570. X    *DC,
  1571. X    *IM,
  1572. X    *EI,
  1573. X    *LL,
  1574. X    *M_IC,    /* Insert char with arg */
  1575. X    *M_DC,    /* Delete char with arg */
  1576. X    *M_AL,    /* Insert line with arg */
  1577. X    *M_DL,    /* Delete line with arg */
  1578. X    *SF,    /* Scroll forward */
  1579. X    *SR,
  1580. X    *SP,    /* Send Cursor Position */
  1581. X    *VB,
  1582. X    *BL,
  1583. X    *IP,    /* insert pad after character inserted */
  1584. X    *lPC,
  1585. X    *NL;
  1586. X#endif
  1587. X
  1588. int    LI,
  1589. X    ILI,    /* Internal lines, i.e., 23 of LI is 24. */
  1590. X    CO,
  1591. X
  1592. X    UL,
  1593. X    MI,
  1594. X    SG,    /* number of magic cookies left by SO and SE */
  1595. X    XS,    /* whether standout is braindamaged */
  1596. X
  1597. X    TABS,
  1598. X    UPlen,
  1599. X    HOlen,
  1600. X    LLlen;
  1601. X
  1602. extern char    PC,
  1603. X        *BC,
  1604. X        *UP;
  1605. X
  1606. X#ifdef notdef
  1607. X    /*
  1608. X     * Are you sure about this one Jon?  On the SYSV system I tried this
  1609. X     * on I got a multiple definition of PC because it was already
  1610. X     * defined in -ltermcap.  Similarly for BC and UP ...
  1611. X     */
  1612. X#ifdef SYSVR2 /* release 2, at least */
  1613. char    PC;
  1614. X#else
  1615. extern char    PC;
  1616. X#endif /* SYSVR2 */
  1617. X#endif
  1618. X
  1619. X#ifndef IBMPC
  1620. static char    tspace[256];
  1621. X
  1622. X/* The ordering of ts and meas must agree !! */
  1623. static char    *ts="vsvealdlspcssosecmclcehoupbcicimdceillsfsrvbksketiteALDLICDCpcipblnl";
  1624. static char    **meas[] = {
  1625. X    &VS, &VE, &AL, &DL, &SP, &CS, &SO, &SE,
  1626. X    &CM, &CL, &CE, &HO, &UP, &BC, &IC, &IM,
  1627. X    &DC, &EI, &LL, &SF, &SR, &VB, &KS, &KE,
  1628. X    &TI, &TE, &M_AL, &M_DL, &M_IC, &M_DC,
  1629. X    &lPC, &IP, &BL, &NL, 0
  1630. X};
  1631. X
  1632. static void
  1633. gets(buf)
  1634. char    *buf;
  1635. X{
  1636. X    buf[read(0, buf, 12) - 1] = 0;
  1637. X}    
  1638. X
  1639. X/* VARARGS1 */
  1640. X
  1641. static void
  1642. TermError(fmt, a)
  1643. char    *fmt;
  1644. X{
  1645. X    printf(fmt, a);
  1646. X    flusho();
  1647. X    _exit(1);
  1648. X}
  1649. X
  1650. void
  1651. getTERM()
  1652. X{
  1653. X    char    *getenv(), *tgetstr() ;
  1654. X    char    termbuf[13],
  1655. X        *termname = NULL,
  1656. X        *termp = tspace,
  1657. X        tbuff[2048];    /* Good grief! */
  1658. X    int    i;
  1659. X
  1660. X    termname = getenv("TERM");
  1661. X    if ((termname == NULL) || (*termname == '\0') ||
  1662. X        (strcmp(termname, "dumb") == 0) ||
  1663. X        (strcmp(termname, "unknown") == 0) ||
  1664. X        (strcmp(termname, "network") == 0)) {
  1665. X        putstr("Enter terminal type (e.g, vt100): ");
  1666. X        flusho();
  1667. X        gets(termbuf);
  1668. X        if (termbuf[0] == 0)
  1669. X            TermError(NullStr);
  1670. X
  1671. X        termname = termbuf;
  1672. X    }
  1673. X
  1674. X    if (tgetent(tbuff, termname) < 1)
  1675. X        TermError("[\"%s\" unknown terminal type?]", termname);
  1676. X
  1677. X    if ((CO = tgetnum("co")) == -1)
  1678. wimperr:    TermError("You can't run JOVE on a %s terminal.\n", termname);
  1679. X
  1680. X    else if (CO > MAXCOLS)
  1681. X        CO = MAXCOLS;
  1682. X
  1683. X    if ((LI = tgetnum("li")) == -1)
  1684. X        goto wimperr;
  1685. X
  1686. X    if ((SG = tgetnum("sg")) == -1)
  1687. X        SG = 0;            /* Used for mode line only */
  1688. X
  1689. X    if ((XS = tgetflag("xs")) == -1)
  1690. X        XS = 0;            /* Used for mode line only */
  1691. X
  1692. X    for (i = 0; meas[i]; i++) {
  1693. X        *(meas[i]) = (char *) tgetstr(ts, &termp);
  1694. X        ts += 2;
  1695. X    }
  1696. X    if (lPC)
  1697. X        PC = *lPC;
  1698. X    if (XS)
  1699. X        SO = SE = 0;
  1700. X
  1701. X    if (CS && !SR)
  1702. X        CS = SR = SF = 0;
  1703. X
  1704. X    if (CS && !SF)
  1705. X        SF = "\n";
  1706. X
  1707. X    if (IM && (*IM == 0))
  1708. X        IM = 0;
  1709. X    else
  1710. X        MI = tgetflag("mi");
  1711. X
  1712. X    UL = tgetflag("ul");
  1713. X
  1714. X    if (NL == 0)
  1715. X        NL = "\n";
  1716. X    else {            /* strip stupid padding information */
  1717. X        while (isdigit(*NL))
  1718. X            NL += 1;
  1719. X        if (*NL == '*')
  1720. X            NL += 1;
  1721. X    }
  1722. X
  1723. X    if (BL == 0)
  1724. X        BL = "\007";
  1725. X
  1726. X#ifdef ID_CHAR
  1727. X    disp_opt_init();
  1728. X#endif
  1729. X    if (CanScroll = ((AL && DL) || CS))
  1730. X        IDline_setup(termname);
  1731. X}
  1732. X
  1733. X#else
  1734. X
  1735. void
  1736. InitCM()
  1737. X{
  1738. X}
  1739. X
  1740. int EGA;
  1741. X
  1742. void
  1743. getTERM()
  1744. X{
  1745. X    char    *getenv(), *tgetstr() ;
  1746. X    char    *termname;
  1747. X        void    init_43(), init_term();
  1748. X    unsigned char lpp(), chpl();
  1749. X
  1750. X    if (getenv("EGA") || (!stricmp(getenv("TERM"), "EGA"))) {
  1751. X       termname = "ega";
  1752. X       init_43();
  1753. X       EGA = 1;
  1754. X    }
  1755. X    else {
  1756. X       termname = "ibmpc";
  1757. X       init_term();
  1758. X       EGA = 0;
  1759. X    }
  1760. X
  1761. X    CO = chpl();
  1762. X    LI = lpp();
  1763. X
  1764. X    SG = 0;            /* Used for mode line only */
  1765. X    XS = 0;            /* Used for mode line only */
  1766. X
  1767. X    CanScroll = 1;
  1768. X}
  1769. X
  1770. X#endif /* IBMPC */
  1771. X
  1772. X#else /* MAC */
  1773. int    LI,
  1774. X    ILI,    /* Internal lines, i.e., 23 of LI is 24. */
  1775. X    CO,
  1776. X    TABS,
  1777. X    SG;
  1778. X    
  1779. void getTERM()
  1780. X{
  1781. X    SG = 0;
  1782. X    CanScroll = 1;
  1783. X}
  1784. X
  1785. X#endif /* MAC */
  1786. X
  1787. X
  1788. END_OF_FILE
  1789. if test 4482 -ne `wc -c <'./term.c'`; then
  1790.     echo shar: \"'./term.c'\" unpacked with wrong size!
  1791. fi
  1792. # end of './term.c'
  1793. fi
  1794. if test -f './tune.h' -a "${1}" != "-c" ; then 
  1795.   echo shar: Will not clobber existing file \"'./tune.h'\"
  1796. else
  1797. echo shar: Extracting \"'./tune.h'\" \(4774 characters\)
  1798. sed "s/^X//" >'./tune.h' <<'END_OF_FILE'
  1799. X/***************************************************************************
  1800. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  1801. X * is provided to you without charge, and with no warranty.  You may give  *
  1802. X * away copies of JOVE, including sources, provided that this notice is    *
  1803. X * included in all the files.                                              *
  1804. X ***************************************************************************/
  1805. X
  1806. X#define TUNED        /* don't touch this */
  1807. X
  1808. X/*#define MAC 1        /* alas, there is no command line for this */
  1809. X
  1810. X#ifdef MAC
  1811. X#    define defined(x) (x)    /* take this out and you're in trouble... */
  1812. X#endif
  1813. X
  1814. X
  1815. X/* The operating system (MSDOS or MAC) must be defined by this point.
  1816. X   IBMPC is defined in the Makefile. All MAC defines should be
  1817. X   numerical (i.e. #define MAC 1) so that defined() will work. */
  1818. X
  1819. X#if !(defined(MSDOS) || defined(MAC))
  1820. X#    define UNIX
  1821. X#endif
  1822. X
  1823. X
  1824. X#ifdef UNIX        
  1825. X            /* pick your version of Unix */
  1826. X#   define BSD4_2    /* Berkeley 4.2 BSD */
  1827. X#   define BSD4_3    /* Berkeley 4.3 BSD and 2.10 BSD */
  1828. X/*# define SYSV        /* for (System III/System V) UNIX systems */
  1829. X/*# define SYSVR2    /* system 5, rel. 2 */
  1830. X            /* M_XENIX is defined by the Compiler */
  1831. X#endif /* UNIX */
  1832. X
  1833. X#ifdef SYSVR2
  1834. X#   ifndef SYSV
  1835. X#    define SYSV    /* SYSV is a subset of SYSVR2 */
  1836. X#   endif
  1837. X#endif
  1838. X
  1839. X#ifdef BSD4_3
  1840. X#   ifndef BSD4_2
  1841. X#    define BSD4_2    /* 4.3 is 4.2 only different. */
  1842. X#   endif
  1843. X#endif
  1844. X
  1845. X#ifdef M_XENIX
  1846. X#   define iAPX286 1    /* we have segments. */
  1847. X#endif
  1848. X
  1849. X#ifdef MSDOS
  1850. X#   ifdef M_I86LM        /* large memory model */
  1851. X#        define NBUF 64
  1852. X#    else
  1853. X#        define NBUF 3
  1854. X#           define SMALL
  1855. X#   endif
  1856. X#   define BUFSIZ    512        /* or 1024 */
  1857. X#endif
  1858. X
  1859. X#ifdef UNIX
  1860. X#   if vax || sel || sun || pyr || mc68000 || tahoe || iAPX286 || GOULD_NP1 || u3b2
  1861. X#    define VMUNIX        /* Virtual Memory UNIX */
  1862. X#    define BUFSIZ    1024
  1863. X#    if iAPX286
  1864. X#        define NBUF    48    /* NBUF*BUFSIZ must be less than 64 kB */
  1865. X#    else
  1866. X#        define NBUF    64    /* number of disk buffers */
  1867. X#    endif /* iAPX286 */
  1868. X#   else
  1869. X#    define SMALL
  1870. X#    define BUFSIZ    512    /* or 1024 */
  1871. X#   endif
  1872. X#
  1873. X#   define LOAD_AV    /* Use the load average for various commands.
  1874. X#               Do not define this if you lack a load average
  1875. X#               system call and kmem is read protected. */
  1876. X#
  1877. X#   define JOB_CONTROL    /* if you have job stopping */
  1878. X#
  1879. X#   ifdef JOB_CONTROL
  1880. X#       define MENLO_JCL
  1881. X#       define IPROCS    /* Interactive processes only work with JOB_CONTROL. */
  1882. X#   endif
  1883. X#
  1884. X#   define SUBPROCS    /* only on UNIX systems (NOT INCORPORATED YET) */
  1885. X#endif /* UNIX */
  1886. X
  1887. X
  1888. X#ifdef SMALL
  1889. X    typedef    unsigned short    disk_line;
  1890. X#else
  1891. X#   if defined(iAPX286) || defined(MSDOS) || defined(MAC)
  1892. X    typedef long    disk_line;
  1893. X#   else
  1894. X    typedef    int    disk_line;
  1895. X#   endif /* iAPX286 */
  1896. X#endif /* SMALL */
  1897. X
  1898. X#define BACKUPFILES    /* enable the backup files code */
  1899. X#define F_COMPLETION    /* filename completion */
  1900. X#define ABBREV        /* word abbreviation mode */
  1901. X#if !(defined(IBMPC) || defined(MAC))
  1902. X#   define ANSICODES    /* extra commands that process ANSI codes */
  1903. X#   define ID_CHAR    /* include code to IDchar */
  1904. X#   define WIRED_TERMS    /* include code for wired terminals */
  1905. X#endif
  1906. X#define CHDIR        /* cd command and absolute pathnames */
  1907. X#define LISP        /* include the code for Lisp Mode */
  1908. X#define CMT_FMT        /* include the comment formatting routines */
  1909. X
  1910. X#ifdef UNIX
  1911. X#   define BIFF        /* if you have biff (or the equivalent) */
  1912. X#   define KILL0    /* kill(pid, 0) returns 0 if proc exists */
  1913. X#   define SPELL    /* spell words and buffer commands */
  1914. X#if !sun && !iAPX286
  1915. X#   define MY_MALLOC    /* use more memory efficient malloc (not on suns) */
  1916. X#endif
  1917. X#endif
  1918. X
  1919. X#define DFLT_MODE    0666    /* file will be created with this mode */
  1920. X
  1921. X#ifdef BSD4_3
  1922. X#   define RESHAPING    /* enable windows to handle reshaping */
  1923. X#endif
  1924. X
  1925. X#ifdef BSD4_2            /* byte_copy(from, to, len) */
  1926. X#   define    byte_copy bcopy    /* use fast assembler version */
  1927. X#endif
  1928. X
  1929. X#ifdef IPROCS
  1930. X#   ifdef BSD4_2
  1931. X#    define INPUT_SIG    SIGIO
  1932. X#   else
  1933. X#    define PIPEPROCS        /* do it with pipes */
  1934. X#    define INPUT_SIG    SIGTINT
  1935. X#   endif
  1936. X#endif
  1937. X
  1938. X#if defined(SYSV) || defined(MSDOS) || defined(M_XENIX)
  1939. X#   define byte_copy(s2, s1, n)    memcpy(s1, s2, n)
  1940. X#   define bzero(s, n)    memset(s, 0, n)
  1941. X#   define index    strchr
  1942. X#   define rindex    strrchr
  1943. X#endif
  1944. X
  1945. X#ifdef MAC
  1946. X#    undef F_COMPLETION    /* can't do it with spaces in filenames */
  1947. X#    undef CHDIR
  1948. X#    define CHDIR 1
  1949. X#    define rindex strrchr
  1950. X#    define index strchr
  1951. X#    define bzero(s,n) setmem(s,n,0)
  1952. X#    define LINT_ARGS
  1953. X#    define NBUF 64
  1954. X#    define BUFSIZ 1024
  1955. X#endif
  1956. X
  1957. X/* These are here since they define things in tune.c.  If you add things to
  1958. X   tune.c, add them here too, if necessary. */
  1959. X
  1960. X#ifndef NOEXTERNS
  1961. extern char
  1962. X    *d_tempfile,
  1963. X    *p_tempfile,
  1964. X    *Recover,
  1965. X    *Joverc,
  1966. X
  1967. X#ifdef PIPEPROCS
  1968. X    *Portsrv,
  1969. X#endif
  1970. X
  1971. X#ifdef MSDOS
  1972. X    CmdDb[],
  1973. X#else
  1974. X    *CmdDb,
  1975. X#endif
  1976. X
  1977. X    TmpFilePath[],
  1978. X    Shell[],
  1979. X    ShFlags[];
  1980. X#endif /* NOEXTERNS */
  1981. X
  1982. X
  1983. END_OF_FILE
  1984. if test 4774 -ne `wc -c <'./tune.h'`; then
  1985.     echo shar: \"'./tune.h'\" unpacked with wrong size!
  1986. fi
  1987. # end of './tune.h'
  1988. fi
  1989. if test -f './vars.c' -a "${1}" != "-c" ; then 
  1990.   echo shar: Will not clobber existing file \"'./vars.c'\"
  1991. else
  1992. echo shar: Extracting \"'./vars.c'\" \(4304 characters\)
  1993. sed "s/^X//" >'./vars.c' <<'END_OF_FILE'
  1994. X/***************************************************************************
  1995. X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
  1996. X * is provided to you without charge, and with no warranty.  You may give  *
  1997. X * away copies of JOVE, including sources, provided that this notice is    *
  1998. X * included in all the files.                                              *
  1999. X ***************************************************************************/
  2000. X
  2001. X#ifndef TXT_TO_C    /* so that jove.h isn't included twice in setmaps */
  2002. X#include "jove.h"
  2003. X#endif
  2004. X
  2005. struct variable    variables[] = {
  2006. X    VARIABLE, "abort-char", &AbortChar, V_CHAR,
  2007. X#ifdef UNIX
  2008. X    VARIABLE, "allow-^S-and-^Q", &OKXonXoff, V_BOOL|V_TTY_RESET,
  2009. X#endif /* UNIX */
  2010. X    VARIABLE, "allow-bad-filenames", &OkayBadChars, V_BOOL,
  2011. X#ifdef ABBREV
  2012. X    VARIABLE, "auto-case-abbrev", &AutoCaseAbbrev, V_BOOL,
  2013. X#endif
  2014. X#ifdef IBMPC
  2015. X    VARIABLE, "background-color", &Bgcolor, V_BASE10|V_CLRSCREEN,
  2016. X#endif /* IBMPC */
  2017. X#ifdef F_COMPLETION
  2018. X    VARIABLE, "bad-filename-extensions", (int *) BadExtensions, V_STRING,
  2019. X#endif
  2020. X    VARIABLE, "c-indentation-increment", &CIndIncrmt, V_BASE10,
  2021. X    VARIABLE, "case-ignore-search", &CaseIgnore, V_BOOL,
  2022. X#ifdef CMT_FMT
  2023. X     VARIABLE, "comment-format", (int *) CmtFmt, V_STRING,
  2024. X#endif
  2025. X#ifdef BIFF
  2026. X    VARIABLE, "disable-biff", &BiffChk, V_BOOL,
  2027. X#endif
  2028. X#ifdef F_COMPLETION
  2029. X    VARIABLE, "display-bad-filenames", &DispBadFs, V_BOOL,
  2030. X#endif
  2031. X#ifndef MAC
  2032. X    VARIABLE, "error-format-string", (int *) ErrFmtStr, V_STRING,
  2033. X    VARIABLE, "error-window-size", &EWSize, V_BASE10,
  2034. X#endif
  2035. X    VARIABLE, "expand-environment-variables", &DoEVexpand, V_BOOL,
  2036. X    VARIABLE, "file-creation-mode", &CreatMode, V_BASE8,
  2037. X    VARIABLE, "files-should-end-with-newline", &EndWNewline, V_BOOL,
  2038. X#ifdef IBMPC
  2039. X    VARIABLE, "foreground-color", &Fgcolor, V_BASE10|V_CLRSCREEN,
  2040. X#endif /* IBMPC */
  2041. X    VARIABLE, "internal-tabstop", &tabstop, V_BASE10|V_CLRSCREEN,
  2042. X    VARIABLE, "left-margin", &LMargin, V_BASE10,
  2043. X#ifdef UNIX
  2044. X    VARIABLE, "mailbox", (int *) Mailbox, V_FILENAME,
  2045. X    VARIABLE, "mail-check-frequency", (int *) &MailInt, V_BASE10,
  2046. X#endif /* UNIX */
  2047. X#ifdef MAC
  2048. X    VARIABLE, "macify", &Macmode, V_BOOL,
  2049. X#endif
  2050. X#ifdef BACKUPFILES
  2051. X    VARIABLE, "make-backup-files", &BkupOnWrite, V_BOOL,
  2052. X#endif
  2053. X    VARIABLE, "mark-threshold", &MarkThresh, V_BASE10,
  2054. X    VARIABLE, "marks-should-float", &MarksShouldFloat, V_BOOL,
  2055. X    VARIABLE, "match-regular-expressions", &UseRE, V_BOOL,
  2056. X    VARIABLE, "meta-key", &MetaKey, V_BOOL|V_TTY_RESET,
  2057. X    VARIABLE, "mode-line", (int *) ModeFmt, V_STRING|V_MODELINE,
  2058. X#ifdef IBMPC
  2059. X    VARIABLE, "mode-line-color", &Mdcolor, V_BASE10|V_MODELINE,
  2060. X#endif    
  2061. X    VARIABLE, "mode-line-should-standout", &BriteMode, V_BOOL|V_MODELINE,
  2062. X    VARIABLE, "paren-flash-delay", &PDelay, V_BASE10,
  2063. X#ifndef MAC
  2064. X    VARIABLE, "physical-tabstop", &phystab, V_BASE10|V_CLRSCREEN,
  2065. X#endif
  2066. X#ifdef IPROCS
  2067. X    VARIABLE, "process-prompt", (int *) proc_prompt, V_STRING,
  2068. X#endif
  2069. X    VARIABLE, "interrupt-character", &IntChar, V_CHAR|V_TTY_RESET,
  2070. X    VARIABLE, "right-margin", &RMargin, V_BASE10,
  2071. X    VARIABLE, "scroll-step", &ScrollStep, V_BASE10,
  2072. X    VARIABLE, "scroll-all-lines", &ScrollAll, V_BOOL,
  2073. X    VARIABLE, "search-exit-char", &SExitChar, V_CHAR,
  2074. X    VARIABLE, "send-typeout-to-buffer", &UseBuffers, V_BOOL,
  2075. X#ifndef MAC
  2076. X    VARIABLE, "shell", (int *) Shell, V_STRING,
  2077. X    VARIABLE, "shell-flags", (int *) ShFlags, V_STRING,
  2078. X#endif
  2079. X#ifndef MSDOS
  2080. X    VARIABLE, "sync-frequency", &SyncFreq, V_BASE10,
  2081. X#endif /* MSDOS */
  2082. X    VARIABLE, "tag-file", (int *) TagFile, V_FILENAME,
  2083. X#ifndef MAC
  2084. X    VARIABLE, "tmp-file-pathname", (int *) TmpFilePath, V_FILENAME,
  2085. X#endif
  2086. X#ifdef UNIX
  2087. X    VARIABLE, "update-time-frequency", &UpdFreq, V_BASE10,
  2088. X#endif /* UNIX */
  2089. X#ifdef ID_CHAR
  2090. X    VARIABLE, "use-i/d-char", &UseIC, V_BOOL,
  2091. X#endif
  2092. X    VARIABLE, "visible-bell", &VisBell, V_BOOL,
  2093. X    VARIABLE, "wrap-search", &WrapScan, V_BOOL,
  2094. X#ifndef MAC
  2095. X    VARIABLE, "write-files-on-make", &WtOnMk, V_BOOL,
  2096. X#endif
  2097. X    VARIABLE, 0, 0, 0
  2098. X};
  2099. X
  2100. X#ifndef TXT_TO_C
  2101. data_obj *
  2102. findvar(prompt)
  2103. char    *prompt;
  2104. X{
  2105. X    static char    *strings[(sizeof variables) / sizeof (struct variable)];
  2106. X    static int    beenhere = 0;
  2107. X    register int    com;
  2108. X
  2109. X    if (beenhere == 0) {
  2110. X        register char    **strs = strings;
  2111. X        register struct variable    *v = variables;
  2112. X
  2113. X        beenhere = 1;
  2114. X        for (; v->Name; v++)
  2115. X            *strs++ = v->Name;
  2116. X        *strs = 0;
  2117. X    }
  2118. X
  2119. X    if ((com = complete(strings, prompt, NOTHING)) < 0)
  2120. X        return 0;
  2121. X    return (data_obj *) &variables[com];
  2122. X}
  2123. X#endif
  2124. END_OF_FILE
  2125. if test 4304 -ne `wc -c <'./vars.c'`; then
  2126.     echo shar: \"'./vars.c'\" unpacked with wrong size!
  2127. fi
  2128. # end of './vars.c'
  2129. fi
  2130. echo shar: End of archive 2 \(of 21\).
  2131. cp /dev/null ark2isdone
  2132. MISSING=""
  2133. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
  2134.     if test ! -f ark${I}isdone ; then
  2135.     MISSING="${MISSING} ${I}"
  2136.     fi
  2137. done
  2138. if test "${MISSING}" = "" ; then
  2139.     echo You have unpacked all 21 archives.
  2140.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2141. else
  2142.     echo You still need to unpack the following archives:
  2143.     echo "        " ${MISSING}
  2144. fi
  2145. ##  End of shell archive.
  2146. exit 0
  2147.